<?php
/**
 * Created by PhpStorm.
 * User: stone
 * Date: 2018/9/7
 * Time: 下午7:20
 */

//生成验证码
function code_radom($length = 4){

    if($length>=8){
        return '验证码不能大于8位';
    }else{
        $code = substr(mt_rand(0,99999999),0,$length);
        return $code;
    }
}
//读取缓存文件

function cache_config($name){

    static $cache = [];

    //将字符串拆成数组
    $info = explode('.',$name);
    //判断当缓存cache里没有内容时 读取缓存文件
    if(!$cache){
        $cache = Cache::get('cache_config');
    }
    return $cache[$info[0]][$info[1]]??'';

}


